package com.spukmk3me.impl.libgdx;

/* $if SPUKMK3ME_DEBUG$ */
import com.spukmk3me.debug.Logger;
/* $endif$ */
import com.spukmk3me.video.Image;
import com.spukmk3me.video.Sprite;

public final class LibgdxSprite extends Sprite
{
    LibgdxSprite( Image image, int x, int y, int w, int h, int spriteW, int spriteH, int[] framePositions, int[] frameSteps )
    {
        super( image, x, y, w, h, spriteW, spriteH, framePositions, frameSteps );
        
        u = (float)this.x / image.width();
        v = (float)this.y / image.height();
        stepU = (float)this.spriteW / image.width();
        stepV = (float)this.spriteH / image.height();
        
        /* $if SPUKMK3ME_DEBUG$ */
        Logger.log( "Created sprite: " + image.getFileHandle().getPath() + "|" + x + ", " + y + ", " +
            this.spriteW + ", " + this.spriteH + "|" + this.nW + ", " + this.nH + '\n' );
        /* $endif$ */
    }
    
    public LibgdxSprite duplicate()
    {
        return new LibgdxSprite( image, x, y, spriteW * nW, spriteH * nH,
            spriteW, spriteH, m_framePositions, getFrameSteps() );
    }
    
    final float u, v, stepU, stepV;
}
